#include "fxcc/yml/Serializer.h"
#include "fxcc/core/graph/common/SDFInfo.h"

using namespace fxcc::yml;

template<>
void fxcc::yml::Serializer::Encode<SDFInfo>(YAML::Node& node, const SDFInfo& inst)
{
    SetVariable<glm::ivec2>(node, "m_ImagePageSize", inst.m_ImagePageSize);
    SetVariable<int>(node, "m_NumPages", inst.m_NumPages);
    SetVariable<int>(node, "m_NumChars", inst.m_NumChars);
    SetVariable<int>(node, "m_NumRows", inst.m_NumRows);
    SetVariable<int>(node, "m_NumCols", inst.m_NumCols);
    SetVariable<int>(node, "m_NumCharsOfPage", inst.m_NumCharsOfPage);
    SetVariable<int>(node, "m_LeftCharsOfPage", inst.m_LeftCharsOfPage);
    SetVariable<int>(node, "m_FontSize", inst.m_FontSize);
    SetVariable<std::string>(node, "m_FontFamily", inst.m_FontFamily);
    SetVariable<std::string>(node, "m_FileName", inst.m_FileName);
}

template<>
bool fxcc::yml::Serializer::Decode<SDFInfo>(const YAML::Node& node, SDFInfo& inst)
{
    GetVariable<glm::ivec2>(node, "m_ImagePageSize", inst.m_ImagePageSize);
    GetVariable<int>(node, "m_NumPages", inst.m_NumPages);
    GetVariable<int>(node, "m_NumChars", inst.m_NumChars);
    GetVariable<int>(node, "m_NumRows", inst.m_NumRows);
    GetVariable<int>(node, "m_NumCols", inst.m_NumCols);
    GetVariable<int>(node, "m_NumCharsOfPage", inst.m_NumCharsOfPage);
    GetVariable<int>(node, "m_LeftCharsOfPage", inst.m_LeftCharsOfPage);
    GetVariable<int>(node, "m_FontSize", inst.m_FontSize);
    GetVariable<std::string>(node, "m_FontFamily", inst.m_FontFamily);
    GetVariable<std::string>(node, "m_FileName", inst.m_FileName);
    return true;
}
